package cn.tedu.property_management_system.controller;


import cn.tedu.property_management_system.entity.Property;
import cn.tedu.property_management_system.service.IPropertyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/property")
public class PropertyController {
    @Autowired
    IPropertyService service;
    @RequestMapping("search/select")
    public List<Property> select(){
        return service.select();
    }
    @RequestMapping("select")
    public List<Property> search(@RequestBody Property property) {
        return service.searchSelect(property);
    }

    @RequestMapping("selects")
    public List<Property> searchs(@RequestBody Property property) {
        return service.searchSelects(property);
    }
    @RequestMapping("add/insert")
    public void insert(@RequestBody Property property){
        service.insert(property);
    }
    @RequestMapping("edit/update")
    public void update(@RequestBody Property property){
        service.update(property);
    }
    @RequestMapping("user/delete")
    public void delete(@RequestBody Property property){
        service.delete(property);
    }
    @RequestMapping("users/delete")
    public int deletes(@RequestBody List<Property> list){
        return service.deletes(list);
    }
}
